home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ Software Uninstall.xpl < prev    next >
Text File  |  2004-05-22  |  4KB  |  125 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="8"
  3. "COUNT"="3"
  4. "UIPATH"="System\Software Installation\Add or Remove Programs"
  5. "NAME"="Add or Remove Programs List Editor"
  6. "LANGUAGE"="VBScript"
  7. "TEXT 1"="Edit Name..."
  8. "TEXT 2"="Edit CMD..."
  9. "TEXT 3"="Delete"
  10. "DESCRIPTION 1"="For every program that has been installed, an item is created here"
  11. "DESCRIPTION 2"="ALWAYS try to use "Start - Settings - Control Panel - Software" to remove an item before using this plug-in."
  12. "DESCRIPTION 3"="This plug-in will NOT uninstall the software, it just removes the selected item from the registry!"
  13. "COMMENT 1"="Bug fix by Neil Turner <totalxs@hotmail.com>"
  14. "VERSION"="2.02"
  15. "AUTHOR"="Xteq Systems"
  16. "CONTACTURL"="http://www.xteq.com"
  17. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  18.  
  19. 'Declaration of some constants
  20. sP="HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\"
  21. sV1="\DisplayName"
  22. sV2="\UninstallString"
  23.  
  24. Dim aryLoc()
  25.  
  26. 'Called when the Plugin is started
  27. SUB Plugin_Initialize
  28.  iCount=RegEnumPaths(sP)
  29.  
  30.  'count how many real items we have
  31.  
  32.  if iCount>0 then
  33.  
  34.     'redim array
  35.     ReDim aryLoc(iCount)
  36.  
  37.     for l=1 to iCount
  38.         aryLoc(l)=RegEnumElement(l)
  39.  
  40.         s=sP & RegEnumElement(l) & sV1
  41.         s=RegReadValue(s)
  42.         Call SetUIElement(l,s)
  43.     next
  44.  else
  45.     Disable
  46.  end if
  47. END SUB
  48.  
  49. 'Called when the Plugin should validate the Data the user has entered
  50. SUB Plugin_CheckData(ElementIndex)
  51. END SUB
  52.  
  53. 'Called when the Plugin should apply the changes
  54. SUB Plugin_Apply(ElementIndex,ElementSubIndex)
  55.  
  56.  if ElementSubIndex>0 then 'OK, user has selected an item
  57.  
  58.    If ElementIndex=1 then 'Rename name
  59.  
  60.       s=sp & aryLoc(ElementSubIndex) & sV1
  61.       sV=RegReadValue(s) 
  62.      
  63.       'DebugMsg ElementSubIndex
  64.       'Debugmsg s
  65.   
  66.        sV=InputWindow("Change Name in List",sV,1)
  67.        if IsEmpty(sV)=false then
  68.           'change it!
  69.           Call RegWriteValue(s,sV,1)          
  70.           Call SetUIElement(ElementSubIndex,sV)   
  71.        end if 
  72.  
  73.    else
  74.     if ElementIndex=3 then  'Delete!!
  75.  
  76.        'Create name of first value
  77.        t=sp & aryLoc(ElementSubIndex) ' "& sV1" removed here, and 's' renamed to 't'
  78.  
  79.        ' Start of new code added by Neil Turner <totalxs@hotmail.com>
  80.        iCount=RegEnumValues(t) ' Enumerate all values
  81.        For u=1 to iCount
  82.            s=RegEnumElement(u) ' Get one of the values...
  83.            s=t & "\" & s ' Get full path of value...
  84.            Call RegDeleteValue(s) ' ... and delete it!
  85.        Next
  86.    
  87.        If IsEmpty(t & "\@")=true then
  88.           Call RegDeletePath(t) ' Finally, delete key!
  89.        else
  90.           If IsEmpty(t & "\@")=true then
  91.              Call RegDeleteValue(t & "\@") ' Otherwise, remove (Default) and then delete key. IsEmpty test is carried out twice - otherwise X-Setup produces an error (don't know why).
  92.           end if
  93.           Call RegDeletePath(t)
  94.        end if
  95.        
  96.  
  97.  ' End of new code
  98.        
  99.  
  100.        'Set item to empty so it is removed from the list...
  101.        Call SetUIElement(ElementSubIndex,"")
  102.  
  103.     else 'Edit command
  104.  
  105.        s=sp & aryLoc(ElementSubIndex) & sV2
  106.        sV=RegReadValue(s) 
  107.   
  108.        sV=InputWindow("Change Uninstall Command",sV,1)
  109.        if IsEmpty(sV)=false then
  110.           'change it!
  111.           Call RegWriteValue(s,sV,1)
  112.        end if 
  113.  
  114.     end if
  115.    end if
  116.  
  117.  else
  118.   Call MsgWarning("No item selected - please select an item first.")
  119.  end if
  120. END SUB
  121.  
  122. 'Called when the Plugin is about to be removed from memory
  123. SUB Plugin_Terminate
  124. END SUB
  125.